package com.samoiloff.util.actions {
	import flash.display.DisplayObject;
	import flash.events.Event;

	/**
	 * @author Samoiloff  http://samoiloff.com/
	 */
	public class AddToStageActionItem extends Action {
		
		protected var _mc : DisplayObject;
		
		public function AddToStageActionItem(mc:DisplayObject) {
			_mc = mc;
		}
		
		override public function start() : void {
			super.start();
			if (_mc.stage) {
				finish();
			} else {
				_mc.addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
			}
		}

		protected function onAddedToStage(event : Event) : void {
			finish();
		}
		
	}
}
